<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Mockery\Exception;

/**
 * App\DoctorType
 *
 * @mixin \Eloquent
 */
class DoctorType extends Model
{
    public $timestamps = false;
    protected $table = 'jkbl_doctortype';

    //显示状态
    const STATUS_OFF = 0;
    const STATUS_ON = 1;

    static $StatusDisplay = [
        self::STATUS_OFF => '不显示',
        self::STATUS_ON => '显示',
    ];


    //是否需要资格证
    const QUAL_NO = 0;
    const QUAL_YES = 1;

    static $QualDisplay = [
        self::QUAL_NO => '不需要',
        self::QUAL_YES => '需要',
    ];


    /**
     * 添加医生类型
     * @param $request
     * @return array
     */
    static function DoctorTypePublish($request)
    {
        try {
            $type = new DoctorType();
            $type->title = $request->title;
            $type->display = $request->display;
            $type->status = $request->status;
            $type->needqualification = $request->needqualification;
            $type->createtime = time();
            if (!$type->save()) {
                return error('添加失败');
            }
            return success('添加成功');
        } catch (Exception $exception) {
            return error();
        }
    }

}
